3.60 \(\int (c+d \tan (e+f x))^2 (A+B \tan (e+f x)+C \tan ^2(e+f x)) \, dx\)

Optimal. Leaf size=131 \[ -\frac {\left (2 c d (A-C)+B \left (c^2-d^2\right )\right ) \log (\cos (e+f x))}{f}-x \left (-A \left (c^2-d^2\right )+2 B c d+c^2 C-C d^2\right )+\frac {d \tan (e+f x) (d (A-C)+B c)}{f}+\frac {B (c+d \tan (e+f x))^2}{2 f}+\frac {C (c+d \tan (e+f x))^3}{3 d f} \]

[Out]

-(c^2*C+2*B*c*d-C*d^2-A*(c^2-d^2))*x-(2*c*(A-C)*d+B*(c^2-d^2))*ln(cos(f*x+e))/f+d*(B*c+(A-C)*d)*tan(f*x+e)/f+1
/2*B*(c+d*tan(f*x+e))^2/f+1/3*C*(c+d*tan(f*x+e))^3/d/f

________________________________________________________________________________________

Rubi [A]  time = 0.16, antiderivative size = 131, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 33, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.121, Rules used = {3630, 3528, 3525, 3475} \[ -\frac {\left (2 c d (A-C)+B \left (c^2-d^2\right )\right ) \log (\cos (e+f x))}{f}-x \left (-A \left (c^2-d^2\right )+2 B c d+c^2 C-C d^2\right )+\frac {d \tan (e+f x) (d (A-C)+B c)}{f}+\frac {B (c+d \tan (e+f x))^2}{2 f}+\frac {C (c+d \tan (e+f x))^3}{3 d f} \]

Antiderivative was successfully verified.

[In]

Int[(c + d*Tan[e + f*x])^2*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2),x]

[Out]

-((c^2*C + 2*B*c*d - C*d^2 - A*(c^2 - d^2))*x) - ((2*c*(A - C)*d + B*(c^2 - d^2))*Log[Cos[e + f*x]])/f + (d*(B
*c + (A - C)*d)*Tan[e + f*x])/f + (B*(c + d*Tan[e + f*x])^2)/(2*f) + (C*(c + d*Tan[e + f*x])^3)/(3*d*f)

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3525

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3528

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(d
*(a + b*Tan[e + f*x])^m)/(f*m), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]

Rule 3630

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_.) + (
f_.)*(x_)]^2), x_Symbol] :> Simp[(C*(a + b*Tan[e + f*x])^(m + 1))/(b*f*(m + 1)), x] + Int[(a + b*Tan[e + f*x])
^m*Simp[A - C + B*Tan[e + f*x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] && NeQ[A*b^2 - a*b*B + a^2*C, 0]
&&  !LeQ[m, -1]

Rubi steps

\begin {align*} \int (c+d \tan (e+f x))^2 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx &=\frac {C (c+d \tan (e+f x))^3}{3 d f}+\int (A-C+B \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx\\ &=\frac {B (c+d \tan (e+f x))^2}{2 f}+\frac {C (c+d \tan (e+f x))^3}{3 d f}+\int (c+d \tan (e+f x)) (A c-c C-B d+(B c+(A-C) d) \tan (e+f x)) \, dx\\ &=-\left (c^2 C+2 B c d-C d^2-A \left (c^2-d^2\right )\right ) x+\frac {d (B c+(A-C) d) \tan (e+f x)}{f}+\frac {B (c+d \tan (e+f x))^2}{2 f}+\frac {C (c+d \tan (e+f x))^3}{3 d f}+\left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) \int \tan (e+f x) \, dx\\ &=-\left (c^2 C+2 B c d-C d^2-A \left (c^2-d^2\right )\right ) x-\frac {\left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) \log (\cos (e+f x))}{f}+\frac {d (B c+(A-C) d) \tan (e+f x)}{f}+\frac {B (c+d \tan (e+f x))^2}{2 f}+\frac {C (c+d \tan (e+f x))^3}{3 d f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [C]  time = 1.18, size = 176, normalized size = 1.34 \[ \frac {3 (d (C-A)+B c) \left (-2 d^2 \tan (e+f x)+i \left ((c+i d)^2 \log (-\tan (e+f x)+i)-(c-i d)^2 \log (\tan (e+f x)+i)\right )\right )+3 B \left (6 c d^2 \tan (e+f x)+(-d+i c)^3 \log (-\tan (e+f x)+i)-(d+i c)^3 \log (\tan (e+f x)+i)+d^3 \tan ^2(e+f x)\right )+2 C (c+d \tan (e+f x))^3}{6 d f} \]

Antiderivative was successfully verified.

[In]

Integrate[(c + d*Tan[e + f*x])^2*(A + B*Tan[e + f*x] + C*Tan[e + f*x]^2),x]

[Out]

(2*C*(c + d*Tan[e + f*x])^3 + 3*(B*c + (-A + C)*d)*(I*((c + I*d)^2*Log[I - Tan[e + f*x]] - (c - I*d)^2*Log[I +
 Tan[e + f*x]]) - 2*d^2*Tan[e + f*x]) + 3*B*((I*c - d)^3*Log[I - Tan[e + f*x]] - (I*c + d)^3*Log[I + Tan[e + f
*x]] + 6*c*d^2*Tan[e + f*x] + d^3*Tan[e + f*x]^2))/(6*d*f)

________________________________________________________________________________________

fricas [A]  time = 0.56, size = 134, normalized size = 1.02 \[ \frac {2 \, C d^{2} \tan \left (f x + e\right )^{3} + 6 \, {\left ({\left (A - C\right )} c^{2} - 2 \, B c d - {\left (A - C\right )} d^{2}\right )} f x + 3 \, {\left (2 \, C c d + B d^{2}\right )} \tan \left (f x + e\right )^{2} - 3 \, {\left (B c^{2} + 2 \, {\left (A - C\right )} c d - B d^{2}\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 6 \, {\left (C c^{2} + 2 \, B c d + {\left (A - C\right )} d^{2}\right )} \tan \left (f x + e\right )}{6 \, f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^2*(A+B*tan(f*x+e)+C*tan(f*x+e)^2),x, algorithm="fricas")

[Out]

1/6*(2*C*d^2*tan(f*x + e)^3 + 6*((A - C)*c^2 - 2*B*c*d - (A - C)*d^2)*f*x + 3*(2*C*c*d + B*d^2)*tan(f*x + e)^2
 - 3*(B*c^2 + 2*(A - C)*c*d - B*d^2)*log(1/(tan(f*x + e)^2 + 1)) + 6*(C*c^2 + 2*B*c*d + (A - C)*d^2)*tan(f*x +
 e))/f

________________________________________________________________________________________

giac [B]  time = 5.57, size = 2128, normalized size = 16.24 \[ \text {result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^2*(A+B*tan(f*x+e)+C*tan(f*x+e)^2),x, algorithm="giac")

[Out]

1/6*(6*A*c^2*f*x*tan(f*x)^3*tan(e)^3 - 6*C*c^2*f*x*tan(f*x)^3*tan(e)^3 - 12*B*c*d*f*x*tan(f*x)^3*tan(e)^3 - 6*
A*d^2*f*x*tan(f*x)^3*tan(e)^3 + 6*C*d^2*f*x*tan(f*x)^3*tan(e)^3 - 3*B*c^2*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f
*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*tan(f*x)^3*tan(e)^3 -
 6*A*c*d*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(
e) + 1)/(tan(e)^2 + 1))*tan(f*x)^3*tan(e)^3 + 6*C*c*d*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f
*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*tan(f*x)^3*tan(e)^3 + 3*B*d^2*log(4*(tan(
f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 +
1))*tan(f*x)^3*tan(e)^3 - 18*A*c^2*f*x*tan(f*x)^2*tan(e)^2 + 18*C*c^2*f*x*tan(f*x)^2*tan(e)^2 + 36*B*c*d*f*x*t
an(f*x)^2*tan(e)^2 + 18*A*d^2*f*x*tan(f*x)^2*tan(e)^2 - 18*C*d^2*f*x*tan(f*x)^2*tan(e)^2 + 6*C*c*d*tan(f*x)^3*
tan(e)^3 + 3*B*d^2*tan(f*x)^3*tan(e)^3 + 9*B*c^2*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2
*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*tan(f*x)^2*tan(e)^2 + 18*A*c*d*log(4*(tan(f*x)
^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*
tan(f*x)^2*tan(e)^2 - 18*C*c*d*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*
x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*tan(f*x)^2*tan(e)^2 - 9*B*d^2*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan
(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*tan(f*x)^2*tan(e)^2
 - 6*C*c^2*tan(f*x)^3*tan(e)^2 - 12*B*c*d*tan(f*x)^3*tan(e)^2 - 6*A*d^2*tan(f*x)^3*tan(e)^2 + 6*C*d^2*tan(f*x)
^3*tan(e)^2 - 6*C*c^2*tan(f*x)^2*tan(e)^3 - 12*B*c*d*tan(f*x)^2*tan(e)^3 - 6*A*d^2*tan(f*x)^2*tan(e)^3 + 6*C*d
^2*tan(f*x)^2*tan(e)^3 + 18*A*c^2*f*x*tan(f*x)*tan(e) - 18*C*c^2*f*x*tan(f*x)*tan(e) - 36*B*c*d*f*x*tan(f*x)*t
an(e) - 18*A*d^2*f*x*tan(f*x)*tan(e) + 18*C*d^2*f*x*tan(f*x)*tan(e) + 6*C*c*d*tan(f*x)^3*tan(e) + 3*B*d^2*tan(
f*x)^3*tan(e) - 6*C*c*d*tan(f*x)^2*tan(e)^2 - 3*B*d^2*tan(f*x)^2*tan(e)^2 + 6*C*c*d*tan(f*x)*tan(e)^3 + 3*B*d^
2*tan(f*x)*tan(e)^3 - 2*C*d^2*tan(f*x)^3 - 9*B*c^2*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)
^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*tan(f*x)*tan(e) - 18*A*c*d*log(4*(tan(f*x)^4
*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*ta
n(f*x)*tan(e) + 18*C*c*d*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 -
 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*tan(f*x)*tan(e) + 9*B*d^2*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*ta
n(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1))*tan(f*x)*tan(e) + 12*C*c^2*ta
n(f*x)^2*tan(e) + 24*B*c*d*tan(f*x)^2*tan(e) + 12*A*d^2*tan(f*x)^2*tan(e) - 18*C*d^2*tan(f*x)^2*tan(e) + 12*C*
c^2*tan(f*x)*tan(e)^2 + 24*B*c*d*tan(f*x)*tan(e)^2 + 12*A*d^2*tan(f*x)*tan(e)^2 - 18*C*d^2*tan(f*x)*tan(e)^2 -
 2*C*d^2*tan(e)^3 - 6*A*c^2*f*x + 6*C*c^2*f*x + 12*B*c*d*f*x + 6*A*d^2*f*x - 6*C*d^2*f*x - 6*C*c*d*tan(f*x)^2
- 3*B*d^2*tan(f*x)^2 + 6*C*c*d*tan(f*x)*tan(e) + 3*B*d^2*tan(f*x)*tan(e) - 6*C*c*d*tan(e)^2 - 3*B*d^2*tan(e)^2
 + 3*B*c^2*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*ta
n(e) + 1)/(tan(e)^2 + 1)) + 6*A*c*d*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + t
an(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1)) - 6*C*c*d*log(4*(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e)
+ tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1)) - 3*B*d^2*log(4*(tan(f*x)^4*tan(e)
^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)/(tan(e)^2 + 1)) - 6*C*c^2
*tan(f*x) - 12*B*c*d*tan(f*x) - 6*A*d^2*tan(f*x) + 6*C*d^2*tan(f*x) - 6*C*c^2*tan(e) - 12*B*c*d*tan(e) - 6*A*d
^2*tan(e) + 6*C*d^2*tan(e) - 6*C*c*d - 3*B*d^2)/(f*tan(f*x)^3*tan(e)^3 - 3*f*tan(f*x)^2*tan(e)^2 + 3*f*tan(f*x
)*tan(e) - f)

________________________________________________________________________________________

maple [B]  time = 0.03, size = 262, normalized size = 2.00 \[ \frac {C \,d^{2} \left (\tan ^{3}\left (f x +e \right )\right )}{3 f}+\frac {B \left (\tan ^{2}\left (f x +e \right )\right ) d^{2}}{2 f}+\frac {C \left (\tan ^{2}\left (f x +e \right )\right ) c d}{f}+\frac {A \,d^{2} \tan \left (f x +e \right )}{f}+\frac {2 B c d \tan \left (f x +e \right )}{f}+\frac {c^{2} C \tan \left (f x +e \right )}{f}-\frac {C \,d^{2} \tan \left (f x +e \right )}{f}+\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) A c d}{f}+\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) B \,c^{2}}{2 f}-\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) B \,d^{2}}{2 f}-\frac {\ln \left (1+\tan ^{2}\left (f x +e \right )\right ) c C d}{f}+\frac {A \arctan \left (\tan \left (f x +e \right )\right ) c^{2}}{f}-\frac {A \arctan \left (\tan \left (f x +e \right )\right ) d^{2}}{f}-\frac {2 B \arctan \left (\tan \left (f x +e \right )\right ) c d}{f}-\frac {C \arctan \left (\tan \left (f x +e \right )\right ) c^{2}}{f}+\frac {C \arctan \left (\tan \left (f x +e \right )\right ) d^{2}}{f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c+d*tan(f*x+e))^2*(A+B*tan(f*x+e)+C*tan(f*x+e)^2),x)

[Out]

1/3/f*C*d^2*tan(f*x+e)^3+1/2/f*B*tan(f*x+e)^2*d^2+1/f*C*tan(f*x+e)^2*c*d+1/f*A*d^2*tan(f*x+e)+2/f*B*c*d*tan(f*
x+e)+1/f*c^2*C*tan(f*x+e)-1/f*C*d^2*tan(f*x+e)+1/f*ln(1+tan(f*x+e)^2)*A*c*d+1/2/f*ln(1+tan(f*x+e)^2)*B*c^2-1/2
/f*ln(1+tan(f*x+e)^2)*B*d^2-1/f*ln(1+tan(f*x+e)^2)*c*C*d+1/f*A*arctan(tan(f*x+e))*c^2-1/f*A*arctan(tan(f*x+e))
*d^2-2/f*B*arctan(tan(f*x+e))*c*d-1/f*C*arctan(tan(f*x+e))*c^2+1/f*C*arctan(tan(f*x+e))*d^2

________________________________________________________________________________________

maxima [A]  time = 0.50, size = 135, normalized size = 1.03 \[ \frac {2 \, C d^{2} \tan \left (f x + e\right )^{3} + 3 \, {\left (2 \, C c d + B d^{2}\right )} \tan \left (f x + e\right )^{2} + 6 \, {\left ({\left (A - C\right )} c^{2} - 2 \, B c d - {\left (A - C\right )} d^{2}\right )} {\left (f x + e\right )} + 3 \, {\left (B c^{2} + 2 \, {\left (A - C\right )} c d - B d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 6 \, {\left (C c^{2} + 2 \, B c d + {\left (A - C\right )} d^{2}\right )} \tan \left (f x + e\right )}{6 \, f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))^2*(A+B*tan(f*x+e)+C*tan(f*x+e)^2),x, algorithm="maxima")

[Out]

1/6*(2*C*d^2*tan(f*x + e)^3 + 3*(2*C*c*d + B*d^2)*tan(f*x + e)^2 + 6*((A - C)*c^2 - 2*B*c*d - (A - C)*d^2)*(f*
x + e) + 3*(B*c^2 + 2*(A - C)*c*d - B*d^2)*log(tan(f*x + e)^2 + 1) + 6*(C*c^2 + 2*B*c*d + (A - C)*d^2)*tan(f*x
 + e))/f

________________________________________________________________________________________

mupad [B]  time = 8.81, size = 141, normalized size = 1.08 \[ \frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {B\,d^2}{2}+C\,c\,d\right )}{f}-x\,\left (A\,d^2-A\,c^2+C\,c^2-C\,d^2+2\,B\,c\,d\right )+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (A\,d^2+C\,c^2-C\,d^2+2\,B\,c\,d\right )}{f}+\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (\frac {B\,c^2}{2}-\frac {B\,d^2}{2}+A\,c\,d-C\,c\,d\right )}{f}+\frac {C\,d^2\,{\mathrm {tan}\left (e+f\,x\right )}^3}{3\,f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((c + d*tan(e + f*x))^2*(A + B*tan(e + f*x) + C*tan(e + f*x)^2),x)

[Out]

(tan(e + f*x)^2*((B*d^2)/2 + C*c*d))/f - x*(A*d^2 - A*c^2 + C*c^2 - C*d^2 + 2*B*c*d) + (tan(e + f*x)*(A*d^2 +
C*c^2 - C*d^2 + 2*B*c*d))/f + (log(tan(e + f*x)^2 + 1)*((B*c^2)/2 - (B*d^2)/2 + A*c*d - C*c*d))/f + (C*d^2*tan
(e + f*x)^3)/(3*f)

________________________________________________________________________________________

sympy [A]  time = 0.47, size = 241, normalized size = 1.84 \[ \begin {cases} A c^{2} x + \frac {A c d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} - A d^{2} x + \frac {A d^{2} \tan {\left (e + f x \right )}}{f} + \frac {B c^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - 2 B c d x + \frac {2 B c d \tan {\left (e + f x \right )}}{f} - \frac {B d^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {B d^{2} \tan ^{2}{\left (e + f x \right )}}{2 f} - C c^{2} x + \frac {C c^{2} \tan {\left (e + f x \right )}}{f} - \frac {C c d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} + \frac {C c d \tan ^{2}{\left (e + f x \right )}}{f} + C d^{2} x + \frac {C d^{2} \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac {C d^{2} \tan {\left (e + f x \right )}}{f} & \text {for}\: f \neq 0 \\x \left (c + d \tan {\relax (e )}\right )^{2} \left (A + B \tan {\relax (e )} + C \tan ^{2}{\relax (e )}\right ) & \text {otherwise} \end {cases} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((c+d*tan(f*x+e))**2*(A+B*tan(f*x+e)+C*tan(f*x+e)**2),x)

[Out]

Piecewise((A*c**2*x + A*c*d*log(tan(e + f*x)**2 + 1)/f - A*d**2*x + A*d**2*tan(e + f*x)/f + B*c**2*log(tan(e +
 f*x)**2 + 1)/(2*f) - 2*B*c*d*x + 2*B*c*d*tan(e + f*x)/f - B*d**2*log(tan(e + f*x)**2 + 1)/(2*f) + B*d**2*tan(
e + f*x)**2/(2*f) - C*c**2*x + C*c**2*tan(e + f*x)/f - C*c*d*log(tan(e + f*x)**2 + 1)/f + C*c*d*tan(e + f*x)**
2/f + C*d**2*x + C*d**2*tan(e + f*x)**3/(3*f) - C*d**2*tan(e + f*x)/f, Ne(f, 0)), (x*(c + d*tan(e))**2*(A + B*
tan(e) + C*tan(e)**2), True))

________________________________________________________________________________________